package com.yy.sso.order.controller;

import com.yy.sso.common.vo.Result;
import com.yy.sso.order.model.Order;
import com.yy.sso.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/order")
public class OrderController {

    @Autowired
    private IOrderService orderService;

    @GetMapping(value = "/user/{userId}")
    public Result<List<Order>> getOrderListByUserId(@PathVariable("userId")Long userId){
        List<Order> list = this.orderService.getOrderListByUserId(userId);
        return Result.ok(list);
    }
}
